<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1" xml:lang="en">
  <title id="he143896">pg_partitions</title>
  <body>
    <p>The <codeph>pg_partitions</codeph> system view is used to show the structure of a partitioned
      table.</p>
    <table id="he143898">
      <title>pg_catalog.pg_partitions</title>
      <tgroup cols="4">
        <colspec colnum="1" colname="col1" colwidth="161.25pt"/>
        <colspec colnum="2" colname="col2" colwidth="70.5pt"/>
        <colspec colnum="3" colname="col3" colwidth="85pt"/>
        <colspec colnum="4" colname="col4" colwidth="147pt"/>
        <thead>
          <row>
            <entry colname="col1">column</entry>
            <entry colname="col2">type</entry>
            <entry colname="col3">references</entry>
            <entry colname="col4">description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry colname="col1">
              <codeph>schemaname</codeph>
            </entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"/>
            <entry colname="col4">The name of the schema the partitioned table is in.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>tablename</codeph>
            </entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"/>
            <entry colname="col4">The name of the top-level parent table.</entry>
          </row>
          <row>
            <entry><codeph>partitionschemaname</codeph></entry>
            <entry>name</entry>
            <entry/>
            <entry>The namespace of the partition table.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitiontablename</codeph>
            </entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"/>
            <entry colname="col4">The relation name of the partitioned table (this is the table name
              to use if accessing the partition directly).</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionname</codeph>
            </entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"/>
            <entry colname="col4">The name of the partition (this is the name to use if referring to
              the partition in an <codeph>ALTER TABLE</codeph> command). <codeph>NULL</codeph> if
              the partition was not given a name at create time or generated by an
                <codeph>EVERY</codeph> clause.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>parentpartitiontablename</codeph>
            </entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"/>
            <entry colname="col4">The relation name of the parent table one level up from this
              partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>parentpartitionname</codeph>
            </entry>
            <entry colname="col2">name</entry>
            <entry colname="col3"/>
            <entry colname="col4">The given name of the parent table one level up from this
              partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitiontype</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">The type of partition (range or list).</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionlevel</codeph>
            </entry>
            <entry colname="col2">smallint</entry>
            <entry colname="col3"/>
            <entry colname="col4">The level of this partition in the hierarchy.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionrank</codeph>
            </entry>
            <entry colname="col2">bigint</entry>
            <entry colname="col3"/>
            <entry colname="col4">For range partitions, the rank of the partition compared to other
              partitions of the same level.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionposition</codeph>
            </entry>
            <entry colname="col2">smallint</entry>
            <entry colname="col3"/>
            <entry colname="col4">The rule order position of this partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionlistvalues</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">For list partitions, the list value(s) associated with this
              partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionrangestart</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">For range partitions, the start value of this partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionstartinclusive</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4"><codeph>T</codeph> if the start value is included in this
              partition. <codeph>F</codeph> if it is excluded.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionrangeend</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">For range partitions, the end value of this partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionendinclusive</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4"><codeph>T</codeph> if the end value is included in this partition.
                <codeph>F</codeph> if it is excluded.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitioneveryclause</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">The <codeph>EVERY</codeph> clause (interval) of this
              partition.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionisdefault</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4"><codeph>T</codeph> if this is a default partition, otherwise
                <codeph>F</codeph>.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>partitionboundary</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">The entire partition specification for this partition.</entry>
          </row>
          <row>
            <entry><codeph>parenttablespace</codeph></entry>
            <entry>text</entry>
            <entry/>
            <entry>The tablespace of the parent table one level up from this partition.</entry>
          </row>
          <row>
            <entry><codeph>partitiontablespace</codeph></entry>
            <entry>text</entry>
            <entry/>
            <entry>The tablespace of this partition.</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </body>
</topic>
